  <template>
  <div class="Iphone">
    <Header></Header>
    <div class='headerImg'>
      <van-swipe :autoplay="3000" lazy-render>
        <van-swipe-item v-for="image in categoryStore.skuInfo.skuImageList" :key="image.id">
          <img :src="image.imgUrl" class="images" />
        </van-swipe-item>
      </van-swipe>
    </div>
    <div class="main">
      <div class="mainText">
        <div class="text">特价</div>
        <div class="price">￥{{categoryStore.skuInfo.price}}</div>
      </div>
    </div>
    <div class="banner">
      <div class="bannertext">
        <div clas="bannerLeft">
          <text class="ico">Pro会员优惠,再省￥99
            <van-icon name="info-o" />
          </text>
        </div>
        <div class="bannerRight"><button>开通</button></div>
      </div>

      <div class="name">{{categoryStore.skuInfo.skuName}}</div>
      <div class="content">
        <div class="contentLeft">
          <div class="box">
            <div class="text1">自营</div>
            <div class="text2">网易严选</div>
          </div>
          <div class="right">查看评价></div>
        </div>

      </div>
      <div class="desc">推荐理由</div>
      <div class="tra">
        <ol>
          <li> &nbsp;&nbsp;高会弹性材质，防摔设计</li>
          <li> &nbsp;&nbsp;可水洗，可纸巾擦拭</li>
          <li> &nbsp;&nbsp;进口液态硅胶，触感细腻</li>
        </ol>
      </div>
      <div class="bottom">
        <div class="bot1">
          <van-icon name="service-o" />
        </div>
        <div class="bot2">立即购买</div>
        <div class="bot3" @click="goCart">加入购物车</div>
      </div>
    </div>

  </div>

</template>
    
    <script lang="ts">
import Header from '../../components/Header/index.vue';
import { useCategoryStore } from '@/store/category';
import { useRouter } from 'vue-router';
import { onMounted } from 'vue';
export default {
  name: 'Iphone',
  components: {
    Header
  }
};
</script>
<script lang="ts" setup>
const categoryStore: any = useCategoryStore();
const router = useRouter();
const goCart = () => {
  router.push('/cart');
 
};
onMounted(() => {
  const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  const random = arr[Math.floor(Math.random() * arr.length)];
  categoryStore.getPhone(random);
})
</script>
    
<style lang="less" scoped>
.Iphone {
  // position: relative;
  width: 100%;
  height: 100%;
  .headerImg {
    height: 375px;
    .images {
      width: 100%;
      height: 375px;
    }
  }
  .main {
    width: 100vw;
    height: 60px;
    background-color: #dd1a21;
    margin: 20px 0;
    .mainText {
      padding: 10px 0;
      color: #fff;
      .text {
        padding-left: 20px;
      }
      .price {
        padding-left: 20px;
      }
      :last-child {
        font-size: 16px;
      }
    }
  }
  .banner {
    width: 100vw;
    height: 300px;
    overflow: hidden;
    .bannertext {
      width: 90vw;
      height: 34px;
      margin: auto;
      background-color: #fff1d2;
      display: flex;
      justify-content: space-between;
      padding: 10px;
      .bannerLeft {
        align-items: center;
        justify-content: center;
        flex: 1;
        text {
          font-size: 12px;
        }
      }
      .bannerRight {
        width: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        button {
          background-color: #12161c;
          color: #f3ca84;
          width: 48px;
          height: 24px;
          border-radius: 10px;
          font-size: 12px;
        }
      }
    }
    .name {
      width: 100%;
      font-size: 16px;
      margin: 12px;
    }
    .content {
      width: 100vw;
      .contentLeft {
        width: 100%;
        height: 40px;
        display: flex;
        justify-content: space-between;
        .box {
          flex: 1;
          display: flex;
          align-items: center;
          .text1 {
            width: 40px;
            height: 20px;
            font-size: 12px;
            background-color: #dd1a21;
            border-radius: 10px;
            color: #fff;
            text-align: center;
            line-height: 20px;
          }
          .text2 {
            width: 80px;
            height: 20px;
            font-size: 12px;
            text-align: center;
            line-height: 20px;
          }
        }
        .right {
          width: 60px;
          line-height: 45px;
          font-size: 12px;
          flex-direction: row-reverse;
        }
      }
    }
    .desc {
      font-size: 18px;
    }
    .tra {
      width: 90%;
      margin: 5px auto;
      background-color: #fafafa;
      font-size: 12px;
    }
    .bottom {
      display: flex;
      z-index: 999;
      width: 100%;
      justify-content: space-evenly;
      font-size: 10px;
      //overflow: hidden;
      height: 45px;
      position: fixed;
      bottom: 0;
     // top: calc(100vh - 45px);
      border-top: 1px solid #888;
      .bot1 {
        width: 30%;
        line-height: 46px;
        text-align: center;
        background-color: #fff;
        border-right: 1px solid #888;
      }
      .bot2 {
        width: 30%;
        background-color: #fff;
        line-height: 46px;
        text-align: center;
      }
      .bot3 {
        width: 40%;
        background-color: #dd1a21;
        line-height: 46px;
        text-align: center;
      }
    }
  }
}
</style>